-
-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Apple String Catalog Support #2893
base: main
Are you sure you want to change the base?
Conversation
@JanCizmar Hi, this is ready to be reviewed |
Impressive job! I am reviewing it now. |
Will look into it, thanks! |
@Test | ||
fun `returns correct parsed result`() { | ||
processFile() | ||
mockUtil.fileProcessorContext.assertLanguagesCount(2) // en, fr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see that by default it converts %@
and %lld
parameters into the Tolgee Universal ICU format by default. Please add such params to the example files and test them.
.assertSinglePlural { | ||
hasText( | ||
""" | ||
{value, plural, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we also need to test what happens when there is some ICU syntax by any chance in the string. Such syntax has to be escaped.
This is tested here:
io.tolgee.unit.formats.apple.in.StringsdictFormatProcessorTest#import with placeholder conversion (disabled ICU)
backend/data/src/main/kotlin/io/tolgee/service/export/ExportFilePathProvider.kt
Outdated
Show resolved
Hide resolved
backend/data/src/main/kotlin/io/tolgee/service/dataImport/processors/FileProcessorContext.kt
Outdated
Show resolved
Hide resolved
It also looks like the exported json is not formatted. |
@ftp27 I believe you are using it wrong. You have to enable the conversion to Tolgee ICU placeholders when importing or you need to disable ICU support on the project configuration level. It seems like you have the ICU support enabled, but you turned off the conversion when importing. This leads to escaped More context here: https://docs.tolgee.io/platform/formats/apple_strings |
I have prepared PR to docs and CLI: |
backend/data/src/main/kotlin/io/tolgee/service/dataImport/processors/FileProcessorContext.kt
Outdated
Show resolved
Hide resolved
backend/data/src/main/kotlin/io/tolgee/service/export/ExportFilePathProvider.kt
Outdated
Show resolved
Hide resolved
To make ktlint pass, you need to run |
@JanCizmar Sorry about that, pushed new changes. |
backend/data/src/main/kotlin/io/tolgee/formats/importCommon/ImportFormat.kt
Outdated
Show resolved
Hide resolved
@JanCizmar, you're right. Without ICU, the translation has been imported as it was supposed to be. But there's still a problem with the default language during export. Also, the whole JSON isn't exported as Xcode saves it, so the git diff will look messy. It's fixable, though, by making a change in the exported document and re-saving the file. |
What is the difference? |
@JanCizmar At first glance, the JSON files from Xcode appear to be beautified, with locale keys sorted alphabetically. I'm not sure if it's possible to replicate the original file after import. Each translation can also have a |
@JanCizmar https://github.com/SokoloffA/radiola/blob/main/Radiola/Localizable.xcstrings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job!
I was thinking more about the state importing and I think, we should completely remove it.
Tolgee is designed to be the source of truth, so I don't think one would ever want to import the state to Tolgee.
If they have all reviewed in he xcstrings, they can always run batch operation and make everything reviewed.
We can keep it for export, but for import, I would just ignore it, because It doesn't look to me that we would need a checkbox to enable/disable the state import and that doesn't worth the hustle.
backend/data/src/main/kotlin/io/tolgee/formats/apple/in/xcstrings/XcstringsFileProcessor.kt
Outdated
Show resolved
Hide resolved
backend/data/src/main/kotlin/io/tolgee/formats/apple/in/xcstrings/XcstringsFileProcessor.kt
Outdated
Show resolved
Hide resolved
backend/data/src/main/kotlin/io/tolgee/formats/apple/in/xcstrings/XcstringsFileProcessor.kt
Outdated
Show resolved
Hide resolved
backend/data/src/main/kotlin/io/tolgee/formats/apple/in/xcstrings/XcstringsFileProcessor.kt
Outdated
Show resolved
Hide resolved
@JanCizmar |
This PR adds support for Apple String Catalog Support
demo
a.mp4
/claim #2300
/closes #2300